package com.tianji.promotion.service;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.promotion.entity.po.Coupon;
import com.tianji.promotion.entity.po.ExchangeCode;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tianji.promotion.entity.query.CodeQuery;
import com.tianji.promotion.entity.vo.ExchangeCodeVO;

/**
 * <p>
 * 兑换码 服务类
 * </p>
 *
 * @author lemon
 */
public interface IExchangeCodeService extends IService<ExchangeCode> {

    /**
     * 异步生成兑换码
     *
     * @param coupon
     */
    void asyncGenerateCode(Coupon coupon);

    /**
     * 分页查询兑换码
     *
     * @param query
     * @return
     */
    PageDTO<ExchangeCodeVO> queryCodePage(CodeQuery query);

    /**
     * 更新兑换码的状态
     *
     * @param serialNum
     * @param flag
     * @return
     */
    boolean updateExchangeCodeMark(long serialNum, boolean flag);

    /**
     * 根据兑换码获取优惠券id
     *
     * @param serialNum
     * @return
     */
    Long exchangeTargetId(long serialNum);
}
